package RPC;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

public class RPCExporter {
	static Executor executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
	public static void exporter(String hostName,int port) throws IOException{
		ServerSocket server = new ServerSocket();
		server.bind(new InetSocketAddress(hostName, port));
		try{
			while(true){
				executor.execute(new ExportTask(server.accept()));
				
			}
		}catch (Exception e) {
			
		} finally {
			server.close();
		}
		
	}
	
}
